<?php

namespace LowCode\UI;

use LowCode\Node;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasDescription;
use LowCode\Traits\Props\HasTitle;
use LowCode\Traits\Slots\HasSlotAction;
use LowCode\Traits\Slots\HasSlotTitle;

/**
 * @method static static make(string|JsExp $status = 'coming-soon');
 */
class Fallback extends Node
{
    use HasTitle, HasDescription;

    use HasSlotAction, HasSlotTitle;

    public function __construct(string|JsExp $status = 'coming-soon')
    {
        parent::__construct();
        $this->showBack()->status($status);
    }

    /**
     * @param string|JsExp $status
     * @return $this
     */
    public function status(string|JsExp $status =  '403' | '404' | '500' | 'coming-soon' | 'offline'): static
    {
        return $this->prop("status",$status);
    }

    /**
     * @param bool|JsExp $bool
     * @return $this
     */
    public function showBack(bool|JsExp $bool = true): static
    {
        return $this->prop("showBack",$bool);
    }

    /**
     * @param string|JsExp $value
     * @return $this
     */
    public function homePath(string|JsExp $value =  '/'): static
    {
        return $this->prop("homePath",$value);
    }

    /**
     * @param string|JsExp $value
     * @return $this
     */
    public function image(string|JsExp $value): static
    {
        return $this->prop("image",$value);
    }

    /**
     * 设置 slot describe 内容
     * @param Node $node
     * @return $this
     */
    public function slotDescribe(Node $node): static
    {
        return $this->addSlot($node,'describe');
    }

}
